import './WijmoA02.scss'
import { useMount, useReactive } from "ahooks"
import { useState } from "react"
import { Button } from 'antd'

import { FlexGrid } from '@grapecity/wijmo.react.grid'

import { getData2 } from '../Data'


const WijmoB06 = () => {

    const InitData = useReactive({ init: null })

    const [Data, setData] = useState()
    const init = (e) => InitData.init = e
    const Rows = () => InitData.init.frozenRows = InitData.init.frozenRows > 0 ? 0 : 2
    const Columns = () => InitData.init.frozenColumns = InitData.init.frozenColumns > 0 ? 0 : 1;

    useMount(() => { setData(getData2(100)) })

    if (Data) {
        return (
            <div className='Page WijmoA02'>
                <FlexGrid id="sample-grid" frozenRows={2} frozenColumns={1} initialized={init} itemsSource={Data} />
                <div>切换冻结</div>
                <Button onClick={Rows}> 行</Button>
                <Button onClick={Columns}> 列</Button>
                <div>frozenRows 冻结行数</div>
                <div>frozenColumns 冻结列数</div>
            </div>
        )
    }

}

export default WijmoB06;